//
//  FormData.h
//  Patrol
//
//  Created by 范武 on 13-2-27.
//  Copyright (c) 2013年 FSTI. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef enum _fieldType {
    radio = 1,
    textField = 2,
    textView = 3
    } FieldType;

@interface FormData : NSObject
@property (copy, nonatomic) NSString * deviceName;
@property (assign, nonatomic) NSInteger taskID;
@property (copy,nonatomic) NSString *planName;
@property (strong, nonatomic) NSArray *fieldData;
- (NSArray *) getUserInputJson;
- (id)initWithDictonary:(NSDictionary *)json;
/**
 *  校验用户是否输入了所有的必填字段，正确返回YES，存在未填字段返回NO
 */
- (BOOL) isUserInputAllTheNessaryFields;
@end

@interface FormField : NSObject<NSCopying>
@property (copy, nonatomic) NSString * fieldID;
@property (assign, nonatomic) FieldType type;
@property (copy, nonatomic) NSString * title;
@property (assign, nonatomic) BOOL notNull;
/*
 * [{title => 正常, value =>1}, {title => 异常, value => 0}]
 */
@property (copy, nonatomic) NSArray * optionValues;
@property (weak, nonatomic) UIView * fieldControl;

- (id) initWithDictonary:(NSDictionary *)json;
- (NSDictionary *)getUserInputJson;
- (NSString *)getUserInput;
@end

@interface FieldOption : NSObject
@property (copy, nonatomic) NSString * title;
@property (assign, nonatomic) NSInteger value;
@end